
project, uses(../data_output/termlimited.dta)




	use ../data_output/termlimited.dta, clear

	xtreg pc1 termlimited lifelimitXtermlimited i.chamber_term, cluster(CandId) fe	
	local r1 = _b[termlimited]
	local se1 = _se[termlimited]
	local w1 = _b[lifelimitXtermlimited]
	local wse1 = _se[lifelimitXtermlimited]
	local n1 = e(N)
	

	gen termlimitXsalary_per_day = termlimited*salary_per_day
	xtreg pc1 termlimited   termlimitXsalary_per_day  i.chamber_term, cluster(CandId) fe
	local r2 = _b[termlimited]
	local se2 = _se[termlimited]
	local w2 = _b[termlimitXsalary_per_day]
	local wse2 = _se[termlimitXsalary_per_day]			
	local n2 = e(N)
	
	gen termlimitedXrank_prof = termlimited*rank_prof
	xtreg pc1 termlimited   termlimitedXrank_prof  i.chamber_term, cluster(CandId) fe
	local r3 = _b[termlimited]
	local se3 = _se[termlimited]
	local w3 = _b[termlimitedXrank_prof]
	local wse3 = _se[termlimitedXrank_prof]	
	local n3 = e(N)
	
	gen OK_CA = state=="OK" | state=="CA"
	gen termlimitedXOK_CA = termlimited*OK_CA
	xtreg pc1 termlimited   termlimitedXOK_CA  i.chamber_term, cluster(CandId) fe
	local r4 = _b[termlimited]
	local se4 = _se[termlimited]
	local w4 = _b[termlimitedXOK_CA]
	local wse4 = _se[termlimitedXOK_CA]	
	local n4 = e(N)
	
	
	use ../data_input/when_are_agenda_setters_valuable.dta, clear
	keep if speakerpowerXspeaker!=.
	collapse (max) speakerpowerXspeaker, by(state  year)
	collapse (mean) speakerpowerXspeaker, by(state  )

	rename speakerpowerXspeaker mooney_index
	keep if regexm(state, "AR|AZ|CA|CO|FL|LA|ME|MI|MO|MT|NV|OH|OK|SD")
	sort mooney_index
	gen rank = _n if mooney_index!=.
	tempfile mooney
	save `mooney'
	
	
	use ../data_output/termlimited.dta, clear
	merge m:1  state   using  `mooney'
	drop if _merge==2
	
	gen termlimitedXmooney_index = termlimited*rank
	xtreg pc1 termlimited   termlimitedXmooney_index  i.chamber_term , cluster(CandId) fe	
	local r5 = _b[termlimited]
	local se5 = _se[termlimited]
	local w5 = _b[termlimitedXmooney_index]
	local wse5 = _se[termlimitedXmooney_index]	
	local n5 = e(N)	
	
	
	
	
	
	cap log close
	quietly {
		set linesize 255
		log using "../tables_figures/main_interactions.tex", text replace
		
		noisily dis "\begin{table}[t]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Variation in the Effect of Electoral Incentives.}"
		noisily dis "\label{tab:interaction}}"
		noisily dis "\begin{tabular}{l ccccc}"
		noisily dis "\toprule\toprule"
		noisily dis "& \multicolumn{5}{c}{Productivity Index} \\[1mm]"
		noisily dis " & (1) & (2) & (3) & (4) & (5) \\[1mm]"
		noisily dis "\midrule"

		noisily dis " Term Limited & " %4.2f `r1' " & " %4.2f `r2' " & " %4.2f `r3' " & " %4.2f `r4' " & " %4.2f `r5' " \\"
		noisily dis "  & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ") & (" %4.2f `se4' ") & (" %4.2f `se5' ") \\[2mm]"		
		
		noisily dis " Term Limited $\times$ & " %4.2f `w1' " &  & \\"
		noisily dis " Lifetime	Ban & (" %4.2f `wse1' ") &  &   \\[2mm]"
	
	
		noisily dis " Term Limited $\times$ &  & " %4.2f `w2' " &   \\"
		noisily dis " Daily Salary (1,000s) & 	   	& (" %4.2f `wse2' ") &   \\[2mm]"	
	
		noisily dis " Term Limited $\times$ &  &   & "  %4.2f `w3' "  \\"
		noisily dis " Professionalization & 	 &  	& (" %4.2f `wse3' ")   \\[2mm]"	

		noisily dis " Term Limited $\times$ &  & &  & "  %4.2f `w4' "  \\"
		noisily dis " Cumulative Ban & 	 &&  	& (" %4.2f `wse4' ")   \\[2mm]"			
		
		noisily dis " Term Limited $\times$ & & & &  & "  %4.2f `w5' "  \\"
		noisily dis " Mooney Ranking & 	 &&  	&& (" %4.2f `wse5' ")   \\[2mm]"				
					
		noisily dis "\midrule "
		noisily dis " N & " %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & " %8.0fc `n4' " & " %8.0fc `n5'   "\\"
		noisily dis "Legislator Fixed Effects & Yes & Yes &  Yes &  Yes &  Yes \\"
		noisily dis "Chamber-Year Fixed Effects & Yes & Yes & Yes &  Yes &  Yes  \\"
		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{6}{p{.8\textwidth}}{\footnotesize "
		noisily dis "In column 1, "
		noisily dis "the indicator for being term-limited is interacted with an indicator for whether or not "
		noisily dis "a state's term limit is a lifetime ban or only requires the legislator to sit out a term."
		

		noisily dis "In column 2, "
		noisily dis "the term-limited indicator is interacted with the average legislative salary per day."
		

		noisily dis "In column 3, "
		noisily dis "the term-limited indicator is interacted with an index of legislative professionalization. "
		noisily dis "In particular, all states are ranked according to \cite{bowen2014should}'s "
		noisily dis	"index of legislative professionalization and the most professional legislature is assinged"
		noisily dis "a score of 1, and the least professional is assigned a score of 0."
			
		noisily dis "In column 4, "
		noisily dis "the term-limited indicator is interacted with an indicator of whether the legislator"		
		noisily dis "is elected in one of the states that use cumulative bans (CA and OK). "
			
		noisily dis "In column 5, "
		noisily dis "the term-limited indicator is interacted with a ranking of the states"		
		noisily dis "based on Mooney's index on the power of legislative leaders. "
						
			
		noisily dis " The main effects of Lifetime Ban, Daily Salary, Professionalization, Cummulative Ban, and "
		noisily dis	" Mooney Ranking are absorbed by the chamber-year fixed effects."
		

		noisily dis " Robust standard errors clustered by legislator and reported in parentheses."
		noisily dis "}"
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
	
		
		log off
	
	}



